open BUFF,"input_expr" or die "no input file\n";
$header = <BUFF>;
$n =50;
$k =0;
$m =1;
$buff = "BUFF$m";
system("mkdir $m");
open(KK,"/data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/test.csh");
@kk = <KK>;
$kk = join("",@kk);
$kk =~ s/\n$//g;
open($buff,">./$m/temp_input");
print $buff $header;
while(<BUFF>)
{
	chomp($_);
	if($n == $k)
	{
		#system("sh /data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/test.csh /data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/$m");
		$km = $kk." /data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/$m\n";
		$wrbuff = "WRBUFF$m";
		open($wrbuff,">/data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/$m/test.csh");
		print $wrbuff $km;
		#die;
		system("qsub /data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/$m/test.csh");
		#print $kk;
		#if($m == 3)
		#{
		#	die;
		#}
		$m++;
		close($wrbuff);
		close($buff);
		$buff = "BUFF$m";
		
		system("mkdir $m");
		open($buff,">./$m/temp_input");
		print $buff $header;
		$k = 0;
		
	}
	print $buff $_."\n";
	$k++;
}

$kk =~ s/\n$//g;
                $km = $kk." /data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/$m\n";
                $wrbuff = "WRBUFF$m";
                open($wrbuff,">/data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/$m/test.csh");
                print $wrbuff $km;

                system("qsub /data1/bsi/BORA_processing/devel/eqtl/parallelize_genotypingsurvival/$m/test.csh");

